package com.example.texted.ALCinterface;

import org.springframework.util.ClassUtils;

import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class DoMain {
    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException {
        //初始化商业逻辑
        Foo b = new Foo();
        //获取注解
        Access access = b.getClass().getAnnotation(Access.class);
        Annotation[] annotations = b.getClass().getAnnotations();
        for (Annotation annotation : annotations) {
            Method value = ClassUtils.getMethodIfAvailable(annotation.getClass(), "value");
            if (value != null) {
                Object invoke = value.invoke(annotation);
                System.out.println(invoke.toString());
            }
        }
        if (access == null || access.value().identify()) {
            System.out.println(Identifier.REFUSE_WORD);
        }
    }
}
